package com.haizhi.crm.sys.configure.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * Created by caochao on 2018/05/31.
 */
@ApiModel(description = "用户自定义模块的每个配置元素的编辑对象" )
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ModuleSettingVo {

    @ApiModelProperty("配置元素的id" )
    private Long settingId;
    @ApiModelProperty("模块的ID" )
    private Long moduleId;
    @ApiModelProperty("配置元素所属的分组" )
    private String category;
    @ApiModelProperty("元素在ui的显示类型，取值如下（text: 文本，checkbox:勾选项，select：下拉项）" )
    private String showType;
    @ApiModelProperty("在ui显示的名称（如果有的话）" )
    private String showName;

    public static ModuleSettingVo fromDo(ModuleSettingDo moduleSettingDo) {
        return ModuleSettingVo.builder()
                .settingId(moduleSettingDo.getId())
                .moduleId(moduleSettingDo.getModuleId())
                .category(moduleSettingDo.getCategory())
                .showType(moduleSettingDo.getShowType())
                .showName(moduleSettingDo.getShowName())
                .build();
    }
}
